$(function(){
    var ind = -1;
    var box;
    $('.line').click(function(){
        var box1 = $(this).next();
        var ind1 = $(this).index();
        $("#img"+ind1/2).attr("src","img/grayhorn.png");
        if(ind == -1){
            box = box1;
            ind = ind1;
            $(box).show();
        }else if(ind == ind1){
            ind = -1;
            $(box).hide();
        }else{
            $(box).hide();
            box = box1;
            ind = ind1;
            $(box).show();
        }
    });
})